/* GUI CONVERTED from rescrp.p (converter v1.75) Wed Nov  8 12:55:33 2000 */
/* rescrp.p - Shift Report                                                */
/* Copyright 1986-2002 QAD Inc., Carpinteria, CA, USA.                    */
/* All rights reserved worldwide.  This is an unpublished work.           */
/*F0PN*/ /*V8:ConvertMode=FullGUIReport                                   */
/* REVISION: 7.0    LAST MODIFIED: 10/18/91     BY: smm *F230*            */
/* REVISION: 7.0    LAST MODIFIED: 05/06/92     BY: emb *F472*            */
/* REVISION: 7.2    LAST MODIFIED: 12/14/94     BY: WUG *FU57*            */
/* REVISION: 8.6    LAST MODIFIED: 10/22/97     BY: ays *K149*            */
/* REVISION: 8.6E   LAST MODIFIED: 02/23/98   BY: *L007* A. Rahane        */
/* REVISION: 8.6E   LAST MODIFIED: 10/04/98   BY: *J314* Alfred Tan       */
/* REVISION: 9.1    LAST MODIFIED: 03/24/00   BY: *N08T* Annasaheb Rahane */
/* REVISION: 9.1    LAST MODIFIED: 08/12/00   BY: *N0KP* myb              */
/* REVISION: 9.1    LAST MODIFIED: 09/11/00   BY: *N0RS* Mudit Mehta      */


/*GUI global preprocessor directive settings */
&GLOBAL-DEFINE PP_PGM_RP TRUE
&GLOBAL-DEFINE PP_ENV_GUI TRUE


/*GUI preprocessor directive settings */
&SCOPED-DEFINE PP_GUI_CONVERT_MODE REPORT

         {mfdtitle.i "b+ "}

/* ********** Begin Translatable Strings Definitions ********* */

&SCOPED-DEFINE rescrp_p_2 "Prod %"
/* MaxLen: Comment: */

&SCOPED-DEFINE rescrp_p_9 "Reference"
/* MaxLen: Comment: */

/*N0RS***********BEGIN COMMENTING*************
 * &SCOPED-DEFINE rescrp_p_1 "Monday"
 * /* MaxLen: Comment: */
 *
 * &SCOPED-DEFINE rescrp_p_3 "Friday"
 * /* MaxLen: Comment: */
 *
 * &SCOPED-DEFINE rescrp_p_4 "------ Shift 2 ------"
 * /* MaxLen: Comment: */
 *
 * &SCOPED-DEFINE rescrp_p_5 "------ Shift 4 ------"
 * /* MaxLen: Comment: */
 *
 * &SCOPED-DEFINE rescrp_p_6 "------ Shift 3 ------"
 * /* MaxLen: Comment: */
 *
 * &SCOPED-DEFINE rescrp_p_7 "------ Shift 1 ------"
 * /* MaxLen: Comment: */
 *
 * &SCOPED-DEFINE rescrp_p_8 "Sunday"
 * /* MaxLen: Comment: */
 *
 * &SCOPED-DEFINE rescrp_p_10 "Tuesday"
 * /* MaxLen: Comment: */
 *
 * &SCOPED-DEFINE rescrp_p_11 "Saturday"
 * /* MaxLen: Comment: */
 *
 * &SCOPED-DEFINE rescrp_p_12 "Thursday"
 * /* MaxLen: Comment: */
 *
 * &SCOPED-DEFINE rescrp_p_13 "Wednesday"
 * /* MaxLen: Comment: */
 *N0RS***********END COMMENTING************* */

/* ********** End Translatable Strings Definitions ********* */

         define variable  site      like si_site.
         define variable  site1     like si_site.
         define variable  prline    like rps_line.
         define variable  prline1   like rps_line.
         define variable  i         as integer.
/*N0RS*
 * define variable  daylabel  as character format "x(12)" extent 7 initial
 *    [{&rescrp_p_8},{&rescrp_p_1},{&rescrp_p_10},{&rescrp_p_13},{&rescrp_p_12},
 *     {&rescrp_p_3},{&rescrp_p_11}].
 *N0RS*/
/*N0RS*/ define variable  daylabel  as character format "x(12)" extent 7.

/*N0RS************* SET INITIAL VALUES ************* */
/*N0RS*/ daylabel[1] = getTermLabel("SUNDAY",12).
/*N0RS*/ daylabel[2] = getTermLabel("MONDAY",12).
/*N0RS*/ daylabel[3] = getTermLabel("TUESDAY",12).
/*N0RS*/ daylabel[4] = getTermLabel("WEDNESDAY",12).
/*N0RS*/ daylabel[5] = getTermLabel("THURSDAY",12).
/*N0RS*/ daylabel[6] = getTermLabel("FRIDAY",12).
/*N0RS*/ daylabel[7] = getTermLabel("SATURDAY",12).

         
/*GUI preprocessor Frame A define */
&SCOPED-DEFINE PP_FRAME_NAME A

FORM /*GUI*/ 
            
 RECT-FRAME       AT ROW 1.4 COLUMN 1.25
 RECT-FRAME-LABEL AT ROW 1   COLUMN 3 NO-LABEL
 SKIP(.1)  /*GUI*/
site   colon 25     site1 label {t001.i}
            prline colon 25   prline1 label {t001.i}
          SKIP(.4)  /*GUI*/
with frame a side-labels width 80 attr-space NO-BOX THREE-D /*GUI*/.

 DEFINE VARIABLE F-a-title AS CHARACTER.
 F-a-title = &IF (DEFINED(SELECTION_CRITERIA) = 0)
  &THEN " Selection Criteria "
  &ELSE {&SELECTION_CRITERIA}
  &ENDIF .
 RECT-FRAME-LABEL:SCREEN-VALUE in frame a = F-a-title.
 RECT-FRAME-LABEL:WIDTH-PIXELS in frame a =
  FONT-TABLE:GET-TEXT-WIDTH-PIXELS(
  RECT-FRAME-LABEL:SCREEN-VALUE in frame a + " ", RECT-FRAME-LABEL:FONT).
 RECT-FRAME:HEIGHT-PIXELS in frame a =
  FRAME a:HEIGHT-PIXELS - RECT-FRAME:Y in frame a - 2.
 RECT-FRAME:WIDTH-CHARS IN FRAME a = FRAME a:WIDTH-CHARS - .5. /*GUI*/

/*GUI preprocessor Frame A undefine */
&UNDEFINE PP_FRAME_NAME



         /* SET EXTERNAL LABELS */
         setFrameLabels(frame a:handle).

         FORM /*GUI*/ 
            shop_site
            si_desc no-label
            rps_line
            ln_desc  no-label
            skip(1)
         with STREAM-IO /*GUI*/  frame b width 132 side-labels no-attr-space.

         /* SET EXTERNAL LABELS */
         setFrameLabels(frame b:handle).

         FORM /*GUI*/  header
/*N0RS*     {&rescrp_p_7} at 14 */
/*N0RS*     {&rescrp_p_4} at 39 */
/*N0RS*     {&rescrp_p_6} at 64 */
/*N0RS*     {&rescrp_p_5} at 89 */
/*N0RS*/    dynamic-function('getTermLabelFillCentered' in h-label,
                     input "SHIFT_1", input 21, input '*') at 14 format "x(21)"
/*N0RS*/    dynamic-function('getTermLabelFillCentered' in h-label,
                     input "SHIFT_2", input 21, input '*') at 39 format "x(21)"
/*N0RS*/    dynamic-function('getTermLabelFillCentered' in h-label,
                     input "SHIFT_3", input 21, input '*') at 64 format "x(21)"
/*N0RS*/    dynamic-function('getTermLabelFillCentered' in h-label,
                     input "SHIFT_4", input 21, input '*') at 89 format "x(21)"
         with STREAM-IO /*GUI*/  frame c1 width 132 no-attr-space no-box.

         FORM /*GUI*/ 
            daylabel[i] no-label
            shft_start1 format ">>>>>"
            shft_hour1
            shft_load1 format "->>9.9<%" label {&rescrp_p_2}
            space(4)
            shft_start2 format ">>>>>"
            shft_hour2
            shft_load2 format "->>9.9<%" label {&rescrp_p_2}
            space(4)
            shft_start3 format ">>>>>"
            shft_hour3
            shft_load3 format "->>9.9<%" label {&rescrp_p_2}
            space(4)
            shft_start4 format ">>>>>"
            shft_hour4
            shft_load4 format "->>9.9<%" label {&rescrp_p_2}
         with STREAM-IO /*GUI*/  frame c width 132 down no-attr-space no-box.

         /* SET EXTERNAL LABELS */
         setFrameLabels(frame c:handle).

         site = global_site.
         site1 = global_site.

/*K149*/ {wbrp01.i}

         
/*GUI*/ {mfguirpa.i true  "printer" 132 }

/*GUI repeat : */
/*GUI*/ procedure p-enable-ui:


            if site1   = hi_char   then site1 = "".
            if prline1 = hi_char   then prline1 = "".

/*K149*/    if c-application-mode <> 'web' then
            
run p-action-fields (input "display").
run p-action-fields (input "enable").
end procedure. /* p-enable-ui, replacement of Data-Entry GUI*/

/*GUI*/ procedure p-report-quote:


/*K149*/    {wbrp06.i &command = update
                      &fields = "  site site1 prline prline1"
                      &frm = "a"}

/*K149*/    if (c-application-mode <> 'web') or
/*K149*/       (c-application-mode = 'web' and
/*K149*/       (c-web-request begins 'data'))
            then do:

               bcdparm = "".
               {mfquoter.i site}
               {mfquoter.i site1}
               {mfquoter.i prline}
               {mfquoter.i prline1}

               if site1   = "" then site1 = hi_char.
               if prline1 = "" then prline1 = hi_char.

/*K149*/    end.

            
/*GUI*/ end procedure. /* p-report-quote */
/*GUI - Field Trigger Section */

/*GUI MFSELxxx removed*/
/*GUI*/ procedure p-report:
/*GUI*/   {gpprtrpa.i  "printer" 132}
/*GUI*/   mainloop: do on error undo, return error on endkey undo, return error:



            {mfphead.i}

            for each shop_cal no-lock where
               (shop_site >= site and shop_site <= site1) and
               (shop_wkctr >= prline and shop_wkctr <= prline1) and
               shop_mch = "" and
            (can-find (ln_mstr where ln_site = shop_site and
                                     ln_line = shop_wkctr) or
             can-find (first shft_det where shft_site = shop_site and
                             shft_wkctr = shop_wkctr and shft_mch = "")):

               find si_mstr no-lock where si_site = shop_site no-error.

               if page-size - line-counter < 13 then page.

               display
                  shop_site
                  shop_wkctr @ rps_line
               with frame b STREAM-IO /*GUI*/ .

               if available si_mstr then
               display
                  si_desc
               with frame b STREAM-IO /*GUI*/ .

               find ln_mstr no-lock where ln_site = shop_site
               and ln_line = shop_wkctr no-error.
               if available ln_mstr then
               display
                  ln_desc
               with frame b STREAM-IO /*GUI*/ .

               view frame c1.

               do i = 1 to 7 with frame c:

                  find shft_det where shft_site = shop_site
                                  and shft_wkctr = shop_wkctr
                                  and shft_mch = shop_mch
                                  and shft_day = i
                  no-lock no-error.
                  if available shft_det then do with frame c:

                     display
                        daylabel[i] no-label
                     with frame c STREAM-IO /*GUI*/ .

                     if shft_start1 <> 0 or shft_hour1 <> 0 then
                     display
                        string(truncate(shft_start1,0),"99") + ":"
                      + string((shft_start1 - truncate(shft_start1,0)) * 60,"99")
                        format "x(5)" @ shft_start1
                        shft_hour1
                        shft_load1
                     with frame c STREAM-IO /*GUI*/ .

                     if shft_start2 <> 0 or shft_hour2 <> 0 then
                     display
                        string(truncate(shft_start2,0),"99") + ":"
                      + string((shft_start2 - truncate(shft_start2,0)) * 60,"99")
                        format "x(5)" @ shft_start2
                        shft_hour2
                        shft_load2
                     with frame c STREAM-IO /*GUI*/ .

                     if shft_start3 <> 0 or shft_hour3 <> 0 then
                     display
                        string(truncate(shft_start3,0),"99") + ":"
                      + string((shft_start3 - truncate(shft_start3,0)) * 60,"99")
                        format "x(5)" @ shft_start3
                        shft_hour3
                        shft_load3
                     with frame c STREAM-IO /*GUI*/ .

                     if shft_start4 <> 0 or shft_hour4 <> 0 then
                     display
                        string(truncate(shft_start4,0),"99") + ":"
                      + string((shft_start4 - truncate(shft_start4,0)) * 60,"99")
                        format "x(5)" @ shft_start4
                        shft_hour4
                        shft_load4
                     with frame c STREAM-IO /*GUI*/ .

                     down 1.

                  end.

               end.

               /*FU57 ADDED FOLLOWING SECTION*/
               for each cal_det no-lock
               where cal_site = shop_site
                and cal_wkctr = shop_wkctr
/*N0RS*        and cal_mch = shop_mch: */
/*N0RS*/       and cal_mch = shop_mch with frame f-a:

                  /* SET EXTERNAL LABELS */
/*N0RS*/          setFrameLabels(frame f-a:handle).

/*K149*           disp */
/*K149*/          display
                     space(13)
                     cal_ref    column-label {&rescrp_p_9}
                     cal_start
                     cal_end
                     cal_shift1
                     cal_shift2
                     cal_shift3
                     cal_shift4
                  with width 132 STREAM-IO /*GUI*/ .

               end.
               /*FU57 END SECTION*/

               
/*GUI*/ {mfguirex.i } /*Replace mfrpexit*/


            end. /* for each */

            
/*GUI*/ {mfguitrl.i} /*Replace mfrtrail*/

/*GUI*/ {mfgrptrm.i} /*Report-to-Window*/


         end. /* repeat */

/*K149*/ {wbrp04.i &frame-spec = a}

/*GUI*/ end procedure. /*p-report*/
/*GUI*/ {mfguirpb.i &flds=" site site1 prline prline1 "} /*Drive the Report*/
